package com.frontResponse.service.impl;

import com.frontResponse.dao.impl.VideoDaoImpl;
import com.frontResponse.service.VideoService;

import java.util.List;
import java.util.Map;

/**
 * @author WangJie
 * @version 1.0
 * @Description:
 * @date: 2020/7/23 22:02
 * @since JDK 1.8
 */
public class VideoServiceImpl implements VideoService {
    /**
     * 查询视频一级分类所有信息
     *
     * @return
     */
    @Override
    public List<Map<String, Object>> selectVideoTopSort() {
        return new VideoDaoImpl().selectVideoTopSort();
    }

    /**
     * 根据一级分类id查询二级分类
     *
     * @param tsvid 一级分类id
     * @return
     */
    @Override
    public List<Map<String, Object>> selectVideoSecondSortByTsvid(String tsvid) {
        return new VideoDaoImpl().selectVideoSecondSortByTsvid(tsvid);
    }

    /**
     * 根据二级分类分页查询视频信息
     *
     * @param ssvid    二级分类id
     * @param page
     * @param pageSize
     * @return
     */
    @Override
    public List<Map<String, Object>> selectVideoInfoByPage(String ssvid, int page, int pageSize) {
//        "nextPageStatus": true, 没必要，只需要返回总条数即可，前端分页组件已做好封装
        return new VideoDaoImpl().selectVideoInfoByPage(ssvid, page, pageSize);
    }

    /**
     * 根据视频id查询对应的电影信息
     *
     * @param vid 视频id
     * @return
     */
    @Override
    public List<Map<String, Object>> selectVideoSoloByVid(String vid) {
        return new VideoDaoImpl().selectVideoSoloByVid(vid);
    }

    /**
     * 根据视频id查询对应剧集信息
     *
     * @param vid 视频id
     * @return
     */
    @Override
    public Map<String, Object> selectTVPlayByVid(String vid) {
        Map<String, Object> videoInfo = new VideoDaoImpl().selectVideoInfoByVid(vid);
        List<Map<String, Object>> TVPlay = new VideoDaoImpl().selectTVPlayByVid(vid);
        videoInfo.put("list", TVPlay);
        return videoInfo;
    }
}
